package com.feri.rbacsys.controller;

import com.feri.rbacsys.entity.Supplier;
import com.feri.rbacsys.service.SupplierService;
import com.feri.rbacsys.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/supplier/")
@Api(tags = "供应商各种接口")
public class SupplierController {

    @Resource
    private SupplierService service;

    @PostMapping("add")
    @ApiOperation("添加供应商")
    public R add(@RequestBody Supplier supplier) {
        return service.add(supplier);
    }

    @PostMapping("deleteflag")
    @ApiOperation("删除供应商信息")
    public R deleteFlag(int id) {
        return service.deleteFlag(id);
    }

    @PostMapping("revert")
    @ApiOperation("还原供应商信息")
    public R revert(int id) {
        return service.revert(id);
    }

    @GetMapping("dellist")
    @ApiOperation("被删除供应商的信息")
    public R delList(int page, int size) {
        return R.ok(service.delList(page, size));
    }

    @GetMapping("suplist")
    @ApiOperation("未被删除供应商的信息")
    public R supList(int page, int size) {
        return R.ok(service.supList(page, size));
    }
}
